package cn.ibizlab.todo.core.pms.domain;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.todo.util.domain.EntityBase;
import cn.ibizlab.todo.util.annotation.DEField;
import cn.ibizlab.todo.util.enums.DEPredefinedFieldType;
import cn.ibizlab.todo.util.enums.DEFieldDefaultValueType;
import cn.ibizlab.todo.util.helper.DataObject;
import cn.ibizlab.todo.util.enums.DupCheck;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.todo.util.annotation.Audit;

import cn.ibizlab.todo.util.domain.EntityClient;

/**
 * ServiceApi [项目团队] 对象
 */
@Data
public class ProjectTeam extends EntityClient implements Serializable {

    /**
     * 团队类型
     */
    @DEField(defaultValue = "project")
    @JSONField(name = "type")
    @JsonProperty("type")
    private String type;

    /**
     * 预计剩余
     */
    @DEField(defaultValue = "0.00")
    @JSONField(name = "left")
    @JsonProperty("left")
    private Double left;

    /**
     * 总计可用
     */
    @JSONField(name = "total")
    @JsonProperty("total")
    private Integer total;

    /**
     * 总计消耗
     */
    @DEField(defaultValue = "0.00")
    @JSONField(name = "consumed")
    @JsonProperty("consumed")
    private Double consumed;

    /**
     * 角色
     */
    @JSONField(name = "role")
    @JsonProperty("role")
    private String role;

    /**
     * 最初预计
     */
    @DEField(defaultValue = "0.00")
    @JSONField(name = "estimate")
    @JsonProperty("estimate")
    private Double estimate;

    /**
     * 受限用户
     */
    @DEField(defaultValue = "no")
    @JSONField(name = "limited")
    @JsonProperty("limited")
    private String limited;

    /**
     * 编号
     */
    @DEField(isKeyField=true)
    @JSONField(name = "id")
    @JsonProperty("id")
    private Long id;

    /**
     * 用户
     */
    @JSONField(name = "account")
    @JsonProperty("account")
    private String account;

    /**
     * 可用工日
     */
    @DEField(defaultValue = "45")
    @JSONField(name = "days")
    @JsonProperty("days")
    private Integer days;

    /**
     * 可用工时/天
     */
    @DEField(defaultValue = "0.0")
    @JSONField(name = "hours")
    @JsonProperty("hours")
    private Double hours;

    /**
     * 加盟日
     */
    @DEField(defaultValue = "0000-00-00")
    @JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8")
    @JSONField(name = "join" , format="yyyy-MM-dd")
    @JsonProperty("join")
    private Timestamp join;

    /**
     * 用户
     */
    @JSONField(name = "username")
    @JsonProperty("username")
    private String username;

    /**
     * 排序
     */
    @DEField(defaultValue = "0")
    @JSONField(name = "order")
    @JsonProperty("order")
    private Integer order;

    /**
     * 项目编号
     */
    @JSONField(name = "root")
    @JsonProperty("root")
    private Long root;


    /**
     * 
     */
    @JSONField(name = "projectteam")
    @JsonProperty("projectteam")
    private cn.ibizlab.todo.core.pms.domain.Project projectteam;




    /**
     * 设置 [团队类型]
     */
    public void setType(String type){
        this.type = type ;
        this.modify("type",type);
    }

    /**
     * 设置 [预计剩余]
     */
    public void setLeft(Double left){
        this.left = left ;
        this.modify("left",left);
    }

    /**
     * 设置 [总计消耗]
     */
    public void setConsumed(Double consumed){
        this.consumed = consumed ;
        this.modify("consumed",consumed);
    }

    /**
     * 设置 [角色]
     */
    public void setRole(String role){
        this.role = role ;
        this.modify("role",role);
    }

    /**
     * 设置 [最初预计]
     */
    public void setEstimate(Double estimate){
        this.estimate = estimate ;
        this.modify("estimate",estimate);
    }

    /**
     * 设置 [受限用户]
     */
    public void setLimited(String limited){
        this.limited = limited ;
        this.modify("limited",limited);
    }

    /**
     * 设置 [用户]
     */
    public void setAccount(String account){
        this.account = account ;
        this.modify("account",account);
    }

    /**
     * 设置 [可用工日]
     */
    public void setDays(Integer days){
        this.days = days ;
        this.modify("days",days);
    }

    /**
     * 设置 [可用工时/天]
     */
    public void setHours(Double hours){
        this.hours = hours ;
        this.modify("hours",hours);
    }

    /**
     * 设置 [加盟日]
     */
    public void setJoin(Timestamp join){
        this.join = join ;
        this.modify("join",join);
    }

    /**
     * 格式化日期 [加盟日]
     */
    public String formatJoin(){
        if (this.join == null) {
            return null;
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(join);
    }
    /**
     * 设置 [排序]
     */
    public void setOrder(Integer order){
        this.order = order ;
        this.modify("order",order);
    }

    /**
     * 设置 [项目编号]
     */
    public void setRoot(Long root){
        this.root = root ;
        this.modify("root",root);
    }

    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param bIncEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
        this.reset("id");
        return super.copyTo(targetEntity,bIncEmpty);
    }
}


